home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Data 2004 February / CD Rom Data Şubat 2004.iso / Media / Internet / host-mon.exe / Examples / Scripts / DrivesList.js < prev    next >
Encoding:
Text File  |  2002-10-16  |  1.7 KB  |  54 lines

  1. //-----------------------------------------------------------------------------
  2. //File    : DrivesList.JS
  3. //Purpose : Sample script test for Advanced Host Monitor
  4. //Comment : Checks list of disk drives on local system. Set test's status to 
  5. //          "Bad" when list of drives changes. E.g. when user map/unmap network
  6. //          drive.
  7. //Req     : Test's option "Translate macros" must be enabled
  8. //Language: JScript
  9. //Version : 1.0
  10. //Author  : KS-Soft (www.ks-soft.net)
  11. //-----------------------------------------------------------------------------
  12.  
  13. statusAlive       = "Host is alive:"
  14. statusDead        = "No answer:"
  15. statusUnknown     = "Unknown:"
  16. statusNotResolved = "Unknown host:"
  17. statusOk          = "Ok:"
  18. statusBad         = "Bad:"
  19. statusBadContents = "Bad contents:"
  20.  
  21. //---- entry point ----
  22.  
  23. function performtest()
  24. {
  25.   if ("%Reply%"=="%"+"Reply"+"%") return statusUnknown+"Please enable 'Translate macros' option";
  26.   var CurrList = GetDrivesList();
  27.   if (("%Reply%"!="") && (CurrList!="%Reply%"))  
  28.     return(statusBad+CurrList);  
  29.   else
  30.     return(statusOk+CurrList);
  31. }
  32.  
  33. //----- functions -----
  34.  
  35. function GetDrivesList()
  36. {
  37.   var DList="", FSO, Drives;
  38.   FSO = new ActiveXObject("Scripting.FileSystemObject");
  39.   Drives = new Enumerator(FSO.Drives);
  40.   for (; !Drives.atEnd(); Drives.moveNext()) DList = DList + Drives.item().DriveLetter;
  41.   return(DList);
  42. }
  43.  
  44.  
  45. function GetCdromDrives()
  46. {
  47.   var DList="", FSO, Drives;
  48.   FSO = new ActiveXObject("Scripting.FileSystemObject");
  49.   Drives = new Enumerator(FSO.Drives);
  50.   for (; !Drives.atEnd(); Drives.moveNext()) 
  51.     if (Drives.item().DriveType == 4) DList = DList + Drives.item().DriveLetter;
  52.   return(DList);
  53. }
  54.